var datePickerOptionsMixin = function (startDateField, endDateField, startOptionName, endOptionName) {
  if (startOptionName === undefined) {
    startOptionName = 'startDateOption';
  }
  if (endOptionName === undefined) {
    endOptionName = 'endDateOption';
  }

  var dateLimit = function (search, time, field) {
    if (field === 'startDate') {
      var endDate = search[endDateField];
      if (endDate !== null) {
        return moment(time).isAfter(endDate, 'day');
      }
    } else if (field === 'endDate') {
      var startDate = search[startDateField];
      if (startDate !== null) {
        return moment(time).isBefore(startDate, 'day');
      }
    }
    return false;
  };

  return {
    data: function () {
      var self = this;
      var vueData = {};
      vueData[startOptionName] = {
        disabledDate: function (time) {
          return dateLimit(self.search, time, 'startDate');
        }
      };
      vueData[endOptionName] = {
        disabledDate: function (time) {
          return dateLimit(self.search, time, 'endDate');
        }
      };
      return vueData;
    }
  };
};
